class Solution:
    def hammingWeight(self, n: int) -> int:
        a = bin(n)
        s = str(a)
        ans = 0
        for i in s:
            if i == "1":
                ans += 1
        return ans